#include "Cbook.h"

Normalbook::Normalbook(): Cbook("noname", true), in_library(true), broken(false){}

Normalbook::Normalbook(const Normalbook& pt): Cbook(pt.name, pt.state), broken(false){}

Normalbook::Normalbook(std::string pt): Cbook(pt, true), broken(false){}

int Normalbook::get_type_book()const { return Type_Normalbook; }

bool Normalbook::change()
{
    if(!in_library)return false;
	state = !state;
    return true;
}

bool Normalbook::borrow()
{
	if(broken)return false;
	if(!in_library)
		return false;

	in_library = true;

	return true;
}

bool Normalbook::in(int days)
{
	if(broken)return false;
	if(in_library)
		return false;

	in_library = false;

	if(days >= 3*30)
		broken = true;

	return true;
}
